import 'package:dailoz/size_config.dart';
import 'package:flutter/material.dart';

class ButtonWidget extends StatelessWidget {
  final double? width;
  final double? height;
  final String? buttonText;
  final Color? buttonColor;
  final Color? buttonTextColor;
  final VoidCallback? onPressed;
  final EdgeInsetsGeometry padding;

  const ButtonWidget(
      {super.key,
      @required this.width,
      @required this.height,
      @required this.buttonText,
      this.buttonColor = Colors.white,
      this.buttonTextColor = Colors.black,
      required this.onPressed,
      this.padding = EdgeInsets.zero});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: padding,
      child: Container(
        width: SizeConfig.getProportionateScreenWidth(width!),
        height: SizeConfig.getProportionateScreenHeight(height!),
        decoration: BoxDecoration(
          color: buttonColor,
          borderRadius: const BorderRadius.all(
            Radius.circular(10.0),
          ),
        ),
        child: TextButton(
          onPressed: onPressed,
          child: Text(
            buttonText!,
            style: TextStyle(
              color: buttonTextColor,
              fontSize: SizeConfig.getProportionateFontSize(16.0),
            ),
          ),
        ),
      ),
    );
  }
}
